From faf323dc5fe2ca9f7ea6a0cc7cbb1b331a9b1cc2 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Tue, 9 Jul 2013 13:09:45 +0800 Subject: [PATCH] * ido.el (ido-add-virtual-buffers-to-list): Robustify. (Bug#14552) --- lisp/ChangeLog | 1 + lisp/ido.el | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3456928bc43..5dbefd5b254 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,7 @@ * ido.el (ido-read-directory-name): Handle fallback. (ido-read-file-name): Update DIR to ido-current-directory. (Bug#1516) + (ido-add-virtual-buffers-to-list): Robustify. (Bug#14552) 2013-07-09 Dmitry Gutov diff --git a/lisp/ido.el b/lisp/ido.el index 12af1952cce..22c8a4e65be 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3461,8 +3461,14 @@ This is to make them appear as if they were \"virtual buffers\"." (setq ido-virtual-buffers nil) (let (name) (dolist (head recentf-list) - (and (setq name (file-name-nondirectory head)) - (null (get-file-buffer head)) + (setq name (file-name-nondirectory head)) + ;; In case HEAD is a directory with trailing /. See bug#14552. + (when (equal name "") + (setq name (file-name-nondirectory (directory-file-name head)))) + (when (equal name "") + (setq name head)) + (and (not (equal name "")) + (null (get-file-buffer head)) (not (assoc name ido-virtual-buffers)) (not (member name ido-temp-list)) (not (ido-ignore-item-p name ido-ignore-buffers)) -- 2.30.2